Esmane kokkupuude Rakega oli mul ühest avatud lähtekoodiga .NET-i projektist. Kuna NAnt ja MSBuild on küllaltki mürarikkad, siis ei mõistnud hästi, et miks selle projektiga tegelejad ei investeerinud piisavalt aega, et see veel loetavamaks teha. Siiski hea, et edasiminek oli.
Praegu käsil olevas projektis viin vaikselt NAnt skriptid üle Rake ja nagu eelnevalt ka lubasin näidet selle kohta, siis siin see ka on.
desc "Cleans the working directory"
task :clean do
Show.message "Cleaning solution from previous build."
Delete.directory Path.to.build
end
desc "Prepares the working directory for a new build"
task :prepare do
Show.message "Creating build directories."
Create.directory Path.to.build
Create.directory Path.to.build.binary
Create.directory Path.to.build.tests
Create.directory Path.to.build.results
end
desc "Update the version information for the build"
task :version do
Show.message "Creating versioning file."
Create.versioning_file.
for_product_named(SOLUTION_NAME).
versioned(SOLUTION_VERSION).
reserve_all_rights_to(SOLUTION_OWNER).
to(Path.to.source.file('CommonAssemblyInfo.cs'))
end
desc "Compiles the solution"
task :compile => [:clean, :prepare, :version] do
Show.message "Compiling solution."
Run.MSBuild.for_solution(SOLUTION_NAME).
with_configuration(SOLUTION_CONFIGURATION).
rebuild
Copy.assemblies.
from(Path.to.source.any.bin.directory(SOLUTION_CONFIGURATION)).
to(Path.to.build.binary)
Copy.configuration.
from(Path.to.source.any.bin.directory(SOLUTION_CONFIGURATION)).
to(Path.to.build.binary)
Copy.binaries.
from(Path.to.tests.any.bin.directory(SOLUTION_CONFIGURATION)).
to(Path.to.build.tests)
Copy.configuration.
from(Path.to.tests.any.bin.directory(SOLUTION_CONFIGURATION)).
to(Path.to.build.tests)
end
desc "Runs tests"
task :test => [:unit_test, :integration_test]
desc "Runs unit tests"
task :unit_test => :compile do
Show.message 'Running unit tests.'
Run.xUnitTests.located_at(Path.to.build.tests).
save_results_to(Path.to.build.results).
from_assembly('Arc.Unit.Tests')
end
desc "Runs integration tests"
task :integration_test => :compile do
Show.message 'Running integration tests.'
Run.xUnitTests.located_at(Path.to.build.tests).
save_results_to(Path.to.build.results).
from_assembly('Arc.Integration.Tests')
end
NAnti skriptidest mõned lõigud ka võrdluseks.
<target name="Compile"
description="Builds entire solution"
depends="Build,CopyAssemblies" />
<target name="Build" depends="Prepare,Version">
<property name="verbosity" value="quiet" />
<property name="verbosity" value="normal" if="${verbose}" />
<exec program="${path.msbuild.console}">
<arg value="${project.root.path}/${project.name}.sln" />
<arg value="/property:Configuration=${project.config}" />
<arg value="/target:Rebuild" />
<arg value="/verbosity:${verbosity}" />
<arg value="/nologo" />
</exec>
</target>
<target name="CopyAssemblies" depends="CopyBinaries, CopyTests" />
<target name="CopyBinaries">
<copy todir="${build.binary.path}" flatten="true" overwrite="true">
<fileset basedir="${project.source.path}">
<include name="**\bin\${project.config}\*.dll" />
<include name="**\bin\${project.config}\*.exe" />
<include name="**\bin\${project.config}\*.xml" />
<include name="**\bin\${project.config}\*.pdb" />
</fileset>
</copy>
<copy todir="${build.binary.path}" overwrite="true">
<fileset basedir="${project.config.path}">
<include name="*.xml" />
<include name="*.config" />
</fileset>
</copy>
</target>
<target name="CopyTests">
<copy todir="${build.tests.path}" flatten="true" overwrite="true">
<fileset basedir="${project.tests.path}">
<include name="**\bin\${project.config}\*.dll" />
<include name="**\bin\${project.config}\*.exe" />
<include name="**\bin\${project.config}\*.xml" />
</fileset>
</copy>
<copy todir="${build.tests.path}" overwrite="true">
<fileset basedir="${project.config.path}">
<include name="*.xml" />
<include name="*.config" />
</fileset>
</copy>
</target>
Kui teil on ideid, kuidas seda veel paremaks teha, siis andke teada. Praegu on alles pool teekonda läbitud.
Loe veel sarnastel teemadel:
- CruiseControl.NET uus ja ilus nägu, 22. juuli
- Miks projektid ebaõnnestuvad?, 6. aprill
- Miks andmete põhised rakendused on ebaõnnestunud, 11. juuni
- Vähem päringuid ASP.NET-ga, 4. september
- Iluvõtted koodile IV, 12. mai
KAIZEN FEED
Telli endale Kaizeni uudisvoog
KOMMENTAARIDE FEED
Telli endale kommentaaride voog
KAIZEN TWITTER
Lühiuudised Kaizeni autoritelt
KAIZEN FACEBOOK
Liitu Kaizeniga
MIS ON KAIZEN?
Kaizen on Saiku tarkvaraarendusealane blogi, kus kirjutame erinevatest lähenemistest meisterlikule tarkvaraarendusele.
KATEGOORIAD
- .NET (18)
- Analüüs/Arhitektuur (11)
- Arendus (66)
- Ettevalmistus (1)
- Juhtimine (2)
- Varia (23)
SILDIPILV
- .NET (41)
- ilus kood (23)
- Arendus (23)
- C# (20)
- Analüüs/Arhitektuur (14)
- Testimine (10)
- raamat (8)
- Ruby (8)
- projektijuhtimine (8)
- printsiibid (6)
- produktiivsus (5)
- ReSharper (5)
- PHP (5)
- NHibernate (4)
- objekt-orienteeritud (4)
- pidev integratsioon (4)
- Viited (4)
- agile (4)
- Java (4)
- Geekdinner (4)
- lean (4)
- raamatukogu (4)
- CI (3)
- Cruise Control.NET (3)
- Robert C. Martin (3)
- scrum (3)
- iteratsioon (3)
- suhtlus (3)
- jQuery (2)
- TechEd 2008 (2)
- Visual Studio (2)
- valideerimine (2)
- intervjuu (2)
- analüüs (1)
- ASP.NET (1)
- ümberstruktureerimine (1)
- üritus (1)
- CodeRush (1)
- dokumentatsioon (1)
- Kent Beck (1)
- LINQ (1)
- Martin Fowler (1)
- Moq (1)
- Rhino Mocks (1)
- stackoverflow (1)
- võltsitud objektid (1)
- Whiteboard Wednesday (1)
- hindamine (1)
- tarkvara kvaliteet (1)
- ajagraafikud (1)
- Saiku (1)
- koolitus (1)
- tagasivaate (1)
- koosolek (1)
- dünaamilised keeled (1)
- staatilised keeled (1)
- FluentNHibernate (1)
- facebook (1)
- aastapäev (1)
- Rake (1)
- Oredev 2008 (1)
- toyota way (1)
- raiskamine (1)
- NDepend (1)
- podcasts (1)
- väle tarkvaraarendus (1)
- raido tonts (1)
- minimal marketable feature (1)
- kasutajalugu (1)
- twitter (1)
- Joomla! (1)
- MVC (1)
- andmebaas (1)
- versioonimine (1)
- diskussioon (1)
- regulaaravaldised (1)
- motiveerimine (1)
- mõõdikud (1)
- agileestonia (1)
- riistvara (1)
- koolitused (1)
- kujundus (1)
- kodulehed (1)
- veeb (1)
