I'm actually on multiple dart projects which can share code. (based on this exemple)
This common code use a library named json_serializable
I'm using it to generate json serialization et deserialization methods for my user model.
I can use the commande pub run build_runner build to start the build. This way I can generate user_model.g.dart (which contains generated serialization and deserialization methods) from user_model.dart
Back to my project I'm adding my shared code as a dependency.
I'd like to use my user_model.dart but there is an error saying that user_model.g.dart doesn't exist. Indeed I haven't launch the build to generate this file.
I'm trying to find a way to launch this generation of code needed by my library but this must be done from my project.
I think I need to add a build file in my lib but I can't find how to do it :/
Schema :
Project X --using--> Lib Sharing Code --using--> json_serialization
You need to commit generated code.
build_runner can only generate code in the project it is run in, not in dependencies.
Related
I have an error 'Lexical or Preprocessor Issue Group' with building xcode project after have built from Unity.
'UnityFramework/UnityFramework-Swift.h file not found'
I have Nice Vibration asset and FB SDK in my project. So I tried to follow this instructions in 'Building for iOS' section, but have no result https://nice-vibrations-docs.moremountains.com/platform-specifics.html#building-for-ios
I makes it with .xcworkspace, not .xcodeproj file. I have read it's right way because of FB SDK needs CocoaPods build pipeline and I should use .xcworkspace. And it's happens in XCode 12, if it matters.
What could be wrong? I spent a few hours and so still there, where I have been :(
I also ran into this issue today (although because of the Firebase SDK, not FB).
The problems seems to be with the post-build processor, which modifies the output XCode project. The NiceVibrations implementation currently only copies a single file (module.modulemap) to the build directory. Instead, we need the entire NiceVibrations/Common/Plugins/iOS/Swift directory to be copied over.
While I can't publish the entire file, I will share my modifications with you for automating this process.
Open the following file:
NiceVibrations/Common/Scripts/Editor/MMNVBuildPostProcessor.cs
Locate the WritePropertiesToFramework function and replace:
System.IO.File.Copy(privateModuleFilepath, destination);
With this:
DirectoryCopy(Path.GetDirectoryName(privateModuleFilepath), Path.GetDirectoryName(destination), true);
You can find the source code for the DirectoryCopy function from the Microsoft dotnet docs here
Edit: You will have to change the second argument of file.CopyTo to true to allow for subsequent rebuilding atop the same directory to avoid runtime errors
Additionally, I have increased the callbackOrder to 60 to ensure that this hook runs last.
I am personally using .xcodeproj instead of workspaces, but it should work fine with workspaces as well. (Firebase uses something called External dependency manager which allows you to configure your project generation preference)
After making these changes, trigger a build from unity and "replace" the target folder to update your XCode files!
I need to build TensorFlowLite Swift Framework/cocoapod from the sources and then use it instead of the original framework in one of the Swift projects.
Downloaded the code and followed the instructions in few scenarios but without success:
1) https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/swift
a) python configure.py
b) CocoaPods developers isn't applicable as it doesn't take the source from the local TensofFlow folder (or I am mistaken?)
c) Bazel developers I do:
bazel build tensorflow/lite/experimental/swift:TensorFlowLite
bazel test tensorflow/lite/experimental/swift:Tests --swiftcopt=-enable-testing
and eventually
generate_xcodeproj.sh --genconfig tensorflow/lite/experimental/swift/TensorFlowLite.tulsiproj:TensorFlowLite --outputfolder ~/path/to/generated/TensorFlowLite.xcodeproj
as a result I get a project with a libtensorflow-lite-experimental-swift-TensorFlowLite.a and few idx files. It compiles and I see the .a file (but both the app and tests don't compile for various reasons) and I don't quite understand how I can use that .a lib with Swift files as there are no module/headers etc. files.
After all these exercises there is TensorFlowLiteSwift.podspec in the root of TensorFlow and in the experimental/Swift folders. It still depends on the TensorFlowLiteC and if I refer to this podspec in another project via path param I can do import TensorFlowLiteC but not import TensorFlowLiteSwift / import TensorFlowLite and I believe the TensorFlowLiteC is still taken from the Internet, not locally.
2) Custom framework path from here:
https://firebase.google.com/docs/ml-kit/ios/use-custom-tflite
Here are few problems:
a) if I try to just use a project with tensorflow_lite.framework added internally then I can't reference TensorFlowLite / TensorFlowLiteC etc. in the Swift file.
b) if I try to follow a route of creating the local pod and reference the pod project then pod install doesn't work because mandatory parameters are not set (used provided example).
I expect to get a Xcode project or workspace which is built from the local TensorFlowFiles and which I can reference from other projects like 'import TensorFlowLiteSwift' or 'import TensorFlowLite'
The problem is that I don't understand even what's the correct route to make it happen.
Thanks.
All right, I figured out the answer here:
build TensorFlowLiteC framework from the root tensorflow folder:
bazel build --config=ios_fat -c opt //tensorflow/lite/experimental/ios:TensorFlowLiteC_framework
The result can be found here: bazel-bin/tensorflow/lite/experimental/ios/TensorFlowLiteC_framework.zip
Unzip the file and add the contents to the new XCode project (in my case it was Swift Single Window App). If you do it via drag'n'drop then XCode will automatically change the Frameworks, libraries and embedded content section, also will modify the Framework paths
Change this setting Build Settings\Linking\Other Linker Flags to -lc++
Done. You can do
import TensorFlowLiteC
and use the source files from the swift folder.
I have code for a VST plugin and need to port some of it to an iOS app.
I have tried building the OSX version and using the lib.a and it doesnt work. When I open the iOS version of it, Xcode shows that it is missing the tagret.
If I copy the code directly into Xcode with all the JUCE modules, and I set the header search paths, I get compilation errors on things like no such type for String
After this latest JUCE update, Xcode would give the same errors until I updated the JUCE file itself, so I think the JUCE build settings or configuration of the new version is doing something differently. How can I get this code into a different Xcode project, so that I can use it?
Can I compile it as a library and use the objects through the header?
JUCE is designed to be included in projects generated by the Introjucer / Projucer (the JUCE project management tool). Without this, the correct preprocessor definitions will not be set up.
If you really needed to include JUCE source code inside your program, you could manually set up these preprocessor definitions (take a look at the AppConfig.h header from a generated project to get an idea of how much work this will be), but you'd really be going against the normal "JUCE way".
Simply including the headers and linking against the library will not work without considerable effort, as the include structure is ... odd ... and there isn't any library to link against directly anyway (the generated projects contain all the JUCE source normally, so there's no need).
Adding the JUCE source files (i.e. .cpp and .mm) to be compiled in a project directly will result in compilation errors, as they need to be compiled in a very specific order which is mandated by the header file (the header files #include certain implementation files after setting up their dependencies).
In short, if you can at all I would advise generating the project with the Projucer and adding other source files in as you need them, rather than the other way around.
I'm using Xcode 6.0.1.
The repo can be found at https://github.com/ippoippo/thornbird
You will need to create your own SpikeKeysForTesting.swift file, using the SpikeKeysForTesting.swift_example as a template.
Anyway, the main problem I am having is that I have source file located in a directory which I was intending to use as a common source directory.
It's a similar technique used by Moya (https://github.com/AshFurrow/Moya) and also documented here : http://www.swift-studies.com/blog/2014/6/30/creating-a-pure-swift-framework-for-both-ios-and-mac
However, when I try to build my ThornbirdFramework project inside the Workspace, the ThornbirdFrameworkTests class is unable to resolve the Thornbird class (as defined in ./thornbird/Thornbird.swift).
Any ideas?
Rebuilt everything, seems OK now.
I'm new to Dart and trying to understand the JavaScript compilation process. After doing to reading, I can't seem to find a way to automatically build an entire project of Dart files at once. Am I missing something?
Thanks
If you run the generate javascript command on any dart project with a main method, all code required by the project in question is automatically compiled to the javascript output file.