Exemple #1
0
 protected override string GenerateCommandLineCommands()
 {
     // Simply 'debug', or 'release'.
     return(AntBuildType.ToLower());
 }
Exemple #2
0
        protected override bool ValidateParameters()
        {
            m_toolFileName = Path.GetFileNameWithoutExtension(ToolName);

            // Ant build directory check
            if (Directory.Exists(AntBuildPath) == false)
            {
                Log.LogError("Ant Build Path '" + AntBuildPath + "' does not exist");
                return(false);
            }

            // Check that the build.xml exists
            string buildXml = Path.GetFullPath(AntBuildPath + "\\build.xml");

            if (File.Exists(buildXml) == false)
            {
                Log.LogError("build.xml '" + buildXml + "' does not exist");
                return(false);
            }

            // Check that the AndroidManifest.xml exists
            string manifestXml = Path.GetFullPath(AntBuildPath + "\\AndroidManifest.xml");

            if (File.Exists(manifestXml) == false)
            {
                Log.LogError("AndroidManifest.xml '" + manifestXml + "' does not exist");
                return(false);
            }

            // Parse the xml to grab the finished apk path
            if (ParseBuildXml(buildXml))
            {
                if (AntBuildType.ToLower() == "debug")
                {
                    OutputFile = Path.GetFullPath(AntBuildPath + "\\" + BUILD_BIN_PATH + "\\" + ApkName + "-debug.apk");
                }
                else
                {
                    OutputFile = Path.GetFullPath(AntBuildPath + "\\" + BUILD_BIN_PATH + "\\" + ApkName + "-release.apk");
                }
            }
            else
            {
                // Parse failed, oh dear.
                Log.LogError("Failed parsing '" + buildXml + "'");
                return(false);
            }

            if (ParseAndroidManifestXml(manifestXml) == false)
            {
                // Parse failed, oh dear.
                Log.LogError("Failed parsing '" + manifestXml + "'");
                return(false);
            }

            // Only one .so library should be input to this task
            if (Sources.Length > 1)
            {
                Log.LogError("More than one .so library being built!");
                return(false);
            }

            m_inputSoPath = Path.GetFullPath(Sources[0].GetMetadata("FullPath"));

            // Copy the .so file into the correct place
            m_armEabiSoPath = Path.GetFullPath(AntBuildPath + "\\" + BUILD_LIB_PATH + "\\" + AntLibraryName + ".so");

            m_antOpts = string.Empty;
            if (JVMHeapInitial != null && JVMHeapInitial.Length > 0)
            {
                m_antOpts += "-Xms" + JVMHeapInitial + "m";
            }
            if (JVMHeapMaximum != null && JVMHeapMaximum.Length > 0)
            {
                if (m_antOpts.Length > 0)
                {
                    m_antOpts += " ";
                }
                m_antOpts += "-Xmx" + JVMHeapMaximum + "m";
            }

            return(base.ValidateParameters());
        }