@@ -713,25 +713,47 @@ class NativeTpk extends Tpk {
713
713
}
714
714
715
715
// Run the native build.
716
- RunResult result = await _processUtils.run (< String > [
717
- tizenSdk.tizenCli.path,
718
- 'build-native' ,
719
- '-a' ,
720
- getTizenCliArch (buildInfo.targetArch),
721
- '-C' ,
722
- buildConfig,
723
- '-c' ,
724
- tizenSdk.defaultNativeCompiler,
725
- '-r' ,
726
- rootstrap.id,
727
- '-e' ,
728
- extraOptions.join (' ' ),
729
- '--' ,
730
- tizenDir.path,
731
- ], environment: variables);
732
- if (result.exitCode != 0 ) {
733
- throwToolExit ('Failed to build native application:\n $result ' );
734
- }
716
+ print ('pkosko rootstrap.id: ${rootstrap .id }' );
717
+ print ('pkosko rootstrap.manifestFile: ${rootstrap .manifestFile }' );
718
+ print ('pkosko build-native PATH: ${tizenDir .path }' );
719
+ print ('pkosko package PATH: ${buildDir .path }' );
720
+ // final List<String> command = <String>[
721
+ // tizenSdk.tizenCli.path,
722
+ // 'build-native',
723
+ // '-a',
724
+ // getTizenCliArch(buildInfo.targetArch),
725
+ // '-C',
726
+ // buildConfig,
727
+ // '-c',
728
+ // tizenSdk.defaultNativeCompiler,
729
+ // '-r',
730
+ // rootstrap.id,
731
+ // '-e',
732
+ // extraOptions.join(' '),
733
+ // '--',
734
+ // tizenDir.path,
735
+ // ];
736
+ // print('pkosko FULL BUILD COMMAND: ${command.join(' ')}');
737
+ // print('pkosko ENVIRONMENT FOR BUILD: ${variables}');
738
+ // RunResult result = await _processUtils.run(<String>[
739
+ // tizenSdk.tizenCli.path,
740
+ // 'build-native',
741
+ // '-a',
742
+ // getTizenCliArch(buildInfo.targetArch),
743
+ // '-C',
744
+ // buildConfig,
745
+ // '-c',
746
+ // tizenSdk.defaultNativeCompiler,
747
+ // '-r',
748
+ // rootstrap.id,
749
+ // '-e',
750
+ // extraOptions.join(' '),
751
+ // '--',
752
+ // tizenDir.path,
753
+ // ], environment: variables);
754
+ // if (result.exitCode != 0) {
755
+ // throwToolExit('Failed to build native application:\n$result');
756
+ // }
735
757
736
758
// TODO(pkosko): this should be separated part
737
759
// The output TPK is signed with an active profile unless otherwise
@@ -749,18 +771,75 @@ class NativeTpk extends Tpk {
749
771
environment.logger
750
772
.printStatus ('The $securityProfile profile is used for signing.' );
751
773
}
752
- result = await _processUtils.run (< String > [
774
+ // final List<String> command2 = <String>[
775
+ // tizenSdk.tizenCli.path,
776
+ // 'package',
777
+ // '-t',
778
+ // 'tpk',
779
+ // if (securityProfile != null) ...<String>['-s', securityProfile],
780
+ // '--',
781
+ // buildDir.path,
782
+ // ];
783
+ // print('pkosko FULL PACKAGE COMMAND: ${command2.join(' ')}');
784
+
785
+ // result = await _processUtils.run(<String>[
786
+ // tizenSdk.tizenCli.path,
787
+ // 'package',
788
+ // '-t',
789
+ // 'tpk',
790
+ // if (securityProfile != null) ...<String>['-s', securityProfile],
791
+ // '--',
792
+ // buildDir.path,
793
+ // ]);
794
+ // if (result.exitCode != 0) {
795
+ // throwToolExit('Failed to generate TPK:\n$result');
796
+ // }
797
+
798
+ // TODO(pkosko): .project file is needed in main dir of project to make this build command work...
799
+ // project name is being read from this file by CLI other properties seem to be not important
800
+ final String method =
801
+ "name: \" m1\" , compiler:\" ${tizenSdk .defaultNativeCompiler }\" , extraoption: \" ${extraOptions .join (' ' ).replaceAll ('"' , '\' ' )}\" , configs:[\" $buildConfig \" ], rootstraps:[{name:\" ${rootstrap .id }\" , arch:\" ${getTizenCliArch (buildInfo .targetArch )}\" }]" ;
802
+ print ('pkosko FULL METHOD: $method ' );
803
+ final List <String > targets = ['tizen' ];
804
+ final Directory tizenServices =
805
+ tizenDir.parent.childDirectory ('tizen_services' );
806
+ if (tizenServices.existsSync ()) {
807
+ final List <FileSystemEntity > tizenServicesList =
808
+ tizenServices.listSync (followLinks: false );
809
+ for (int i = 0 ; i < tizenServicesList.length; ++ i) {
810
+ print ('pkosko FOUND SERVICE: ${tizenServicesList [i ].path }' );
811
+ // TODO(pkosko): to make it work we need to first make a 'flutter-level' build for this service
812
+ targets
813
+ .add (tizenServicesList[i].path + Platform .pathSeparator + 'tizen' );
814
+ }
815
+ }
816
+
817
+ final String build =
818
+ 'name: "b1", methods: ["m1"], targets: ["${targets .join ('","' )}"]' ;
819
+ const String package = 'name: "test", targets:["b1"]' ;
820
+
821
+ final List <String > buildAppCommand = < String > [
753
822
tizenSdk.tizenCli.path,
754
- 'package' ,
755
- '-t' ,
756
- 'tpk' ,
823
+ 'build-app' ,
824
+ '-m' ,
825
+ method,
826
+ '-b' ,
827
+ build,
828
+ '-p' ,
829
+ package,
757
830
if (securityProfile != null ) ...< String > ['-s' , securityProfile],
758
- '-- ' ,
831
+ '-o ' ,
759
832
buildDir.path,
760
- ]);
833
+ '--' ,
834
+ tizenDir.parent.path,
835
+ ];
836
+ print ('pkosko FULL BUILD-APP COMMAND: ${buildAppCommand .join (' ' )}' );
837
+ final RunResult result =
838
+ await _processUtils.run (buildAppCommand, environment: variables);
761
839
if (result.exitCode != 0 ) {
762
840
throwToolExit ('Failed to generate TPK:\n $result ' );
763
841
}
842
+
764
843
if (securityProfile == null ) {
765
844
environment.logger.printStatus (
766
845
'The TPK was signed with a default certificate. You can create one using Certificate Manager.\n '
@@ -769,18 +848,30 @@ class NativeTpk extends Tpk {
769
848
);
770
849
}
771
850
772
- final String tpkArch = buildInfo.targetArch
773
- .replaceFirst ('arm64' , 'aarch64' )
774
- .replaceFirst ('x86' , 'i586' );
775
- final File outputTpk = buildDir.childFile (
776
- tizenProject.outputTpkName.replaceFirst ('.tpk' , '-$tpkArch .tpk' ));
851
+ // TODO(pkosko): find better way to determine file name
852
+ List <FileSystemEntity > list = buildDir.listSync (followLinks: false );
853
+ FileSystemEntity outputTpkFile;
854
+ for (int i = 0 ; i < list.length; ++ i) {
855
+ if (list[i].basename.endsWith ('.tpk' )) {
856
+ outputTpkFile = list[i];
857
+ print ('pkosko GENERATED FILENAME IS: ${outputTpkFile .path }' );
858
+ }
859
+ }
860
+
861
+ // final String tpkArch = buildInfo.targetArch
862
+ // .replaceFirst('arm64', 'aarch64')
863
+ // .replaceFirst('x86', 'i586');
864
+ final File outputTpk = buildDir.childFile (outputTpkFile.basename);
865
+ // tizenProject.outputTpkName.replaceFirst('.tpk', '-$tpkArch.tpk'));
777
866
if (! outputTpk.existsSync ()) {
778
867
throwToolExit (
779
- 'Build succeeded but the expected TPK not found:\n ${result .stdout }' );
868
+ 'Build succeeded but the expected TPK ($ outputTpk ) not found:\n ${result .toString () }' );
780
869
}
781
870
782
871
// Copy and rename the output TPK.
783
872
outputTpk.copySync (outputDir.childFile (tizenProject.outputTpkName).path);
873
+ print (
874
+ 'pkosko GENERATED TPK FILE moved to : ${outputDir .childFile (tizenProject .outputTpkName ).path }' );
784
875
785
876
// Extract the contents of the TPK to support code size analysis.
786
877
final Directory tpkrootDir = outputDir.childDirectory ('tpkroot' );
0 commit comments